<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 <head>
  <title>Cross-browser issues</title>

<!-- YUI CSS -->
<link rel="stylesheet" type="text/css" href="../lib/yui/reset/reset-min.css">
<link rel="stylesheet" type="text/css" href="../lib/yui/fonts/fonts-min.css">
<link rel="stylesheet" type="text/css" href="../lib/yui/container/assets/container.css"> 
<link rel="stylesheet" type="text/css" href="../lib/yui/assets/skins/sam/skin.css">

<!-- Demo CSS -->
<link rel="stylesheet" type="text/css" href="css/demo.css"/>
<link rel="stylesheet" type="text/css" href="css/dpSyntaxHighlighter.css">

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../css/inputEx.css' />

<!-- YUI Library -->
<script type="text/javascript" src="../lib/yui/yahoo/yahoo-min.js"></script> 
<script type="text/javascript" src="../lib/yui/dom/dom-min.js"></script> 
<script type="text/javascript" src="../lib/yui/event/event-min.js"></script>
<script type="text/javascript" src="../lib/yui/container/container-min.js"></script>
<script type="text/javascript" src="../lib/yui/connection/connection-min.js"></script>
<script type="text/javascript" src="../lib/yui/json/json-min.js"></script>

<!-- InputEx -->
<script src="../js/inputex.js"  type='text/javascript'></script>
<script src="../js/Field.js"  type='text/javascript'></script>
<script src="../js/fields/StringField.js"  type='text/javascript'></script>
<script src="../js/fields/EmailField.js"  type='text/javascript'></script>
<script src="../js/fields/UrlField.js"  type='text/javascript'></script>
<script src="../js/fields/SelectField.js"  type='text/javascript'></script>
<script src="../js/Group.js"  type='text/javascript'></script>
<script src="../js/Form.js"  type='text/javascript'></script>

 </head>

 <body class="yui-skin-sam">
	
<p class='demoTitle'>Float + position relative issues (missing hasLayout)</p>

<div style="margin-left:20px;">
  <p style="margin-bottom:5px;">As said by <a target="_new" href="http://www.satzansatz.de/cssd/rpfloat.html" title="Satzansatz">Ingo Chao</a> :</p>
  <blockquote style="margin-left:20px;"><p>"In IE, a relatively positioned container with a floating child needs "layout" to gain control over the float. Otherwise, the layering, the offset and the width formatting may give unexpected results."</p></blockquote>
  <br />
  <p style="margin-left:20px"><a target="_new" href="http://www.satzansatz.de/cssd/onhavinglayout.html">More info on hasLayout property in IE.</a></p>
  <br />
  <p>With InputEx, this situation can occur if you render a form (or even a single field) in a container that does not have hasLayout = true (cf. link above).</p>
</div>

<!-- Example 1 -->
<div class='exampleDiv'>

	<p class="title">Test the bug</p>

	<p>Try to click the "Move the forms" button (you must use IE 6 or 7)</p>

	<div class='demoContainer' id='container1'>


		<style type="text/css">
			div.block1 { padding:10px; background-color:#FFFFFF; }
			div.block2 { border: 2px solid #888888; padding:15px; width:370px;}
         
			div.container { margin-right:10px;}
			div#firstContainer { position:relative; }
			div#secondContainer { position:relative; zoom:1; }
		</style>
		
		<script>

		YAHOO.util.Event.addListener(window, 'load', function() {
			// Required for the UrlField
			YAHOO.inputEx.spacerUrl = "../images/space.gif";

			// Example 1
			new YAHOO.inputEx.Form( { 
				fields: [ 
					{type: 'select', inputParams: {label: 'Title', name: 'title', selectValues: ['Mr','Mrs','Mme'] } },
					{inputParams: {label: 'Firstname', name: 'firstname', required: true, value:'Jacques' } }, 
					{inputParams: {label: 'Lastname', name: 'lastname', value:'Dupont' } }, 
					{type:'email', inputParams: {label: 'Email', name: 'email'}}, 
					{type:'url', inputParams: {label: 'Website',name:'website'}} 
				], 
				buttons: [{type: 'submit', value: 'Change'}], 	
				parentEl: 'leftBlock2' 
			});
			
			// Example 2
			new YAHOO.inputEx.Form( { 
				fields: [ 
					{type: 'select', inputParams: {label: 'Title', name: 'title', selectValues: ['Mr','Mrs','Mme'] } },
					{inputParams: {label: 'Firstname', name: 'firstname', required: true, value:'Jacques' } }, 
					{inputParams: {label: 'Lastname', name: 'lastname', value:'Dupont' } }, 
					{type:'email', inputParams: {label: 'Email', name: 'email'}}, 
					{type:'url', inputParams: {label: 'Website',name:'website'}} 
				], 
				buttons: [{type: 'submit', value: 'Change'}], 	
				parentEl: 'rightBlock2' 
			});
			
		});
		
		function moveForms() {
			var formContainers = YAHOO.util.Dom.getElementsByClassName('block1'), formContainer;
			
			for (var i = 0; i < formContainers.length; i++) {
				formContainer = formContainers[i];
				
				if (formContainer.style.display == 'none') {
					formContainer.style.display = '';
				} else {
					formContainer.style.display = 'none';
				}
			}
		};
		</script>
		
		<div id="firstContainer" class="container">
			<div class="block1" style="display:none;">This form is buggy with IE.<br /><br />Form has not moved, or is broken !<br/></div>
			<div id="leftBlock2" class="block2"></div>
		</div>
		
		<div id="secondContainer" class="container">
			<div class="block1" style="display:none;">This form is Ok.<br /><br />Form has moved as expected.<br/></div>
			<div id="rightBlock2" class="block2"></div>
		</div>
      
      <div style="clear:both; margin-bottom:5px;"></div>

      <button onclick="moveForms()">Move the forms</button>

	</div>
	
	<div class='codeContainer'>
		<textarea name="code" class="xhtml">
			<style type="text/css">
				div#firstContainer { position:relative; }
				div#secondContainer { 
					position:relative; 
					zoom:1; /* Set zoom property to force hasLayout = true, so boxes have standard behavior */
				}
			</style>
	   </textarea>
	</div>

</div>



<script src="js/dpSyntaxHighlighter.js"></script>
<script language="javascript"> 
dp.SyntaxHighlighter.HighlightAll('code');
</script>

</body>
</html>